//
//  BookManager.m
//  HomeWork 03 - NSString NSArray NSMutableArray
//
//  Created by dllo on 16/7/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "BookManager.h"

@implementation BookManager
- (instancetype)init {
    self = [super init];
    if (self) {
        _mArr = [NSMutableArray array];
    }
    return self;
}
- (void)addBook:(Book *)book {
    [self.mArr addObject:book];
    
}
- (BOOL)removeBook:(Book *)book {
    if (book.name != nil) {
        [self.mArr removeObject:book];
        return YES;
    } else {
        return NO;
    }
    
}
- (void)showInfo{
    for (Book *book in self.mArr) {
        NSLog(@"书名:%@  价钱:%@",book.name,book.price);
    }
}
- (void)lookForBook:(NSString *)bookName price:(NSString *)price {
    if (bookName != nil) {
        for (Book *book in self.mArr) {
            if (book.name == bookName) {
                book.price = price;
            }
        }
        
    }
}
@end
